package cn.lyq.card.ui.statistics

import cn.lyq.card.base.SimpleVM


class StatisticsVM : SimpleVM() {

    var goodsId: Int = -1
    var agentId: Int = -1
    var team: Int = 0

    val pageSize = 20

    fun posCount() = simpleEmit {
        repository.homeService.posCount()
    }

    fun posStatistic(type: Int) = simpleEmit {
        if (type == 0) {
            repository.homeService.myPosCount()
        } else {
            repository.homeService.teamPosCount()
        }
    }

    fun getDevProxy(index: Int, page: Int) = simpleEmit {
        val isAct = if (index == 1) 0 else 1
        if (agentId == -1) {
            repository.homeService.getDevProxy(team, isAct, goodsId, page, pageSize)
        } else {
            repository.homeService.getAgentDevDetail(team, isAct, agentId, page, pageSize)
        }
    }
}